﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Max.PH5_2103A.Shopping.TEntityFrame.DTO
{
    /// <summary>
    /// 统一返回值
    /// </summary>
    public class ResponseResultDto
    {
        public ResponseStateCode Code { get; set; } = ResponseStateCode.Success;
        #region Message
        //public string Message { get; set; }
        private string message;
        public string Message
        {
            get
            {
                if (string.IsNullOrEmpty(message))
                {
                    //显示枚举的本身名称（如果需要显示Display的Name,需要用反射）
                    message = this.Code.ToString();
                }
                return message;
            }
            set => message = value;
        }
        #endregion
        public dynamic Data { get; set; }
    }

    /// <summary>
    /// 统一返回值的状态码
    /// </summary>
    public enum ResponseStateCode
    {
        Success = 200,
        Failed = 500,
        [Display(Name = "参数错误")]
        Err_Params = 601,
    }


}
